package org.darkforest.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import net.sf.json.JSONObject;
import org.darkforest.vo.GoodsSku;

import java.util.List;
import java.util.Map;

/**
 * Created by valentina on 15/3/7.
 * 商品详细信息 包含商品图片 商品规格信息等
 */
public class GoodsDetail extends GoodsCommonWithBLOBs{

    public static final GoodsDetail EMPTY_GOODS = new GoodsDetail();

    private List<GoodsImages> goodsImages;      //包含的商品图片信息

    private List<Goods> goodsList;                        //包含的商品信息

    private List<Spec> specList;

    private Goods goods;                        //包含的商品信息

    private List<GoodsTag> goodsTags;

    private List<GoodsSku> goodsSkus;


    public List<GoodsTag> getGoodsTags() {
        return goodsTags;
    }

    public void setGoodsTags(List<GoodsTag> goodsTags) {
        this.goodsTags = goodsTags;
    }

    private String specPrice;   //规格对应的商品价格 json串格式

    private String specGoodsId;   //规格对应的商品ID json串格式


    public String getSpecGoodsId() {
        return specGoodsId;
    }

    public void setSpecGoodsId(String specGoodsId) {
        this.specGoodsId = specGoodsId;
    }

    public String getSpecPrice() {
        return specPrice;
    }

    public void setSpecPrice(String specPrice) {
        this.specPrice = specPrice;
    }

    public Goods getGoods() {
        return goods;
    }

    public void setGoods(Goods goods) {
        this.goods = goods;
    }

    public List<Spec> getSpecList() {
        return specList;
    }

    public void setSpecList(List<Spec> specList) {
        this.specList = specList;
    }

    public List<GoodsImages> getGoodsImages() {
        return goodsImages;
    }

    public void setGoodsImages(List<GoodsImages> goodsImages) {
        this.goodsImages = goodsImages;
    }

//    public Goods getGoods() {
//        return goods;
//    }
//
//    public void setGoods(Goods goods) {
//        this.goods = goods;
//    }

    @JsonIgnore
    public Integer getGoodsStorage(){
        Integer num = 0;
        if(this.goodsList.size()>0){
            for (Goods goods:goodsList){
                num+=goods.getGoodsStorage();
            }
        }
        return num;
    }

    public List<Goods> getGoodsList() {
        return goodsList;
    }

    public void setGoodsList(List<Goods> goodsList) {
        this.goodsList = goodsList;
    }

    public List<GoodsSku> getGoodsSkus() {
        return goodsSkus;
    }

    public void setGoodsSkus(List<GoodsSku> goodsSkus) {
        this.goodsSkus = goodsSkus;
    }
}
